<%-- 
    Document   : registro_usuarios
    Created on : 30/06/2013, 11:37:44 PM
    Author     : angel
--%>

<%@page import="ConexionBD.*" %>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        
        
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="recursos/style.css" rel="stylesheet" type="text/css" />
        <link  href="recursos/css/humanity/jquery-ui-1.10.2.custom.css" rel="stylesheet">
        <script src="recursos/js/jquery1-9.js"></script>
        <script src="recursos/js/jquery-ui-1.10.2.custom.js"></script>
        <script type="text/javascript" src="recursos/js/jquery.fancybox.js"></script>
        <link rel="stylesheet" type="text/css" href="recursos/css/jquery.fancybox.css" media="screen" />
        <title>JSP Page</title>
    </head>
    <body>
         <script type="text/javascript">
 
  function enviar() {  
  var nombre = document.getElementById("nombre").value;
  var apellido = document.getElementById("apellido").value;
  var dpi = document.getElementById("dpi").value;
  var correo = document.getElementById("correo").value;
  var pass = document.getElementById("pass").value;
  var cpass = document.getElementById("cpass").value;
  var usuario= document.getElementById("usuario").value;
  
  var error=0; 

  if (nombre =="") { AbrirAlerta("Ingrese Nombre"); error++;} else
  if (apellido=="") { AbrirAlerta("Ingrese Apellido"); error++;} else
  if (dpi =="") { AbrirAlerta("Ingrese dpi"); error++;} else
  if (correo =="") { AbrirAlerta("Ingrese Correo"); error++;} else
  if (usuario =="") { AbrirAlerta("Ingrese Usuario"); error++;} else
  if (validaEmail(correo)== false) { AbrirAlerta("Email Incorrecto"); error++;} else
  if (cpass!=pass){ AbrirAlerta("Password no coinciden"); error++;} else
  
  
  
  if (error == 0)
   document.forms["registro"].submit();
  }
  

    function validaEmail(email) 
	{ 
	if(/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/.test(email)){
         return true
    } else
         return false
	}

	
	function AbrirAlerta(msg) {
                $.fancybox('<div class="padding_fancy"><div id="fancy_msg" class="font-dinB"><strong>'+msg+'</strong></div>', {
                minWidth: 200,
                minHeight: 100,
                maxWidth: 200,
                maxHeight: 100,
                autoSize: false
            });
        }





</script>



        
   
<div id="wrapper"> 

	<div id="header">

    	<div id="site_title">
            <h1><a href="index.jsp"><img src="recursos/images/logo.png" alt="logo" /></a></h1>
        </div> <!-- end of site_title -->
        
        <ul id="social_box">
            <li><a href="#"><img src="recursos/images/facebook.png" alt="facebook" /></a></li>
            <li><a href="#"><img src="recursos/images/twitter.png" alt="twitter" /></a></li>
            <li><a href="#"><img src="recursos/images/linkedin.png" alt="linkin" /></a></li>
            <li><a href="#"><img src="recursos/images/technorati.png" alt="technorati" /></a></li>
            <li><a href="#"><img src="recursos/images/myspace.png" alt="myspace" /></a></li>                
        </ul>
        
    </div> <!-- end of header -->
    
    <div id="menu">
    	<div class="home"><a href="index.jsp"></a></div>
        <ul>
            <li><a href="articulos.jsp"><span>Articulos</span></a></li>
            <li><a href="registro_usuarios.jsp"><span>Usuarios</span></a></li>
            <li><a href="buscar.jsp"><span>Buscar</span></a></li>
            <li><a href="reportes.jsp" class="last"><span>Reportes</span></a></li>
        </ul>    	
    </div> <!-- end of menu -->
    
    <div id="content_wrapper">
    	<div id="content_top"></div>
        <div id="content">
            <center>
            <h2>Registro Usuarios</h2>
      
            <form id="registro"  action="/prototipo/usuario_nuevo.jsp" method="post">
                <table>
                    <tr>
                        <td> <h4>Nombre</h4></td>
                        <td> <h4>Apellido</h4></td>
                    </tr>
                      <tr>
                          <td><input type="text" id="nombre" name="nombre" value=""></td>
                          <td> <input type="text" id="apellido" name="apellido" value=""></td>
                       </tr>
                     <tr>
                         <td><h4>DPI</h4></td>
                         <td><h4>Correo</h4></td>
                        
                       </tr>
                     <tr>
                          <td><input type="text" id="dpi" name="dpi" value=""></td>
                         <td><input type="text" id="correo" name="correo" value=""></td>
                         
                         
                     </tr>
                     <tr>
                          <td> <h4>Username</h4></td>
                           <td> <h4>Tipo de Usuario</h4></td>
                     </tr>
                     <tr>
                          <td><input type="text" id="usuario" name="usuario" value=""></td>
                          <td>  <%
                                Conexion c1 = new Conexion();
                                 c1.Conectar();
                                 String res = c1.get_tipos_usuarios();
                                out.println(res);
        %>               </td>
                     </tr>
                     <tr>
                         <td><h4>Password</h4></td>  
                         <td><h4>Confirm Password</h4></td>
                     </tr>
                     <tr>
                         <td><input type="password" id="pass" name="pass" value=""></td>     
                         <td><input type="password" id="cpass" name="cpass" value=""></td>

                     </tr>
       
                
                </table>
                                <br><br>
                               <input id ="botonguardar" name="botonguardar" type="button" class="submit_btn" value="Guardar" onclick="enviar();"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input id ="botoncancelar" name="botoncancelar" type="button" class="submit_btn" value="Cancelar" /></form>
				<br />
				<br />
			<br />
			<label id="privilegios">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label><br />
			<br />
			
			<div class="cleaner">
			</div>
            </center>
        </div>
        <div id="content_bottom"></div>
	</div>
 
    
    
    <div id="footer">

        Copyright © 2013 <a href="#">Grupo 5 </a> - 
        <a href="index.jsp" target="_parent">Prototipo Fase 3</a> 
        
    
    </div> <!-- end of footer -->
    
</div> <!-- end of wrapper -->    

</body>

</html>
